import request from '@/utils/request'

/**
 *
 * @param {Number}} channelId 频道id
 * @param {Number} timestamp 时间戳
 * @returns 获取频道对应的文章列表
 */
export const reqGetArticles = (channelId, timestamp) => {
  return request({
    method: 'get',
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp
    }
  })
}

/**
 *
 * @param {Number} articleId 文章id
 * @returns 标记文章
 */
export const reqDislikeArticle = (articleId) => {
  return request({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: articleId
    }
  })
}

/**
 *
 * @param {Number} articleId 文章id
 * @param {Number} type 举报类型
 * @returns 举报文章
 */
export const reqReportArticle = (articleId, type) => {
  return request({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target: articleId,
      type
    }
  })
}

export const reqGetArticleDetail = id => {
  return request({
    method: 'get',
    url: '/v1_0/articles/' + id
  })
}
